﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentValidation;
using Huirui.Cavan.Domain.MainBoundedContext.Resources;

namespace Huirui.Cavan.Domain.MainBoundedContext.SystemModule
{
    public class BaseCodeRuleValidator : AbstractValidator<BaseCodeRule>
    {
        public BaseCodeRuleValidator()
        {
            RuleFor(d => d.Name).NotEmpty().WithMessage(Messages.Validate_NameNotEmpty);
            RuleFor(d => d.Corporation).NotNull().WithMessage(Messages.Validate_CorporationNotNull);
            RuleFor(d => d.Prefix).NotEmpty().WithMessage("前缀不可为空");
            RuleFor(d => d.SerialNumberNumber).GreaterThan(0).WithMessage("流水号数需大于0");
            RuleFor(d => d.SerialNumberStart).GreaterThan(0).WithMessage("起始流水号需大于0");
        }
    }
}
